import { createSlice } from "@reduxjs/toolkit";

interface UserState {
	username: string
	token: string
	aboutList: {
		url: string
		title: string
		id: string
	}[]
}

const initialState: UserState = {
  username: "",
  token: "",
  aboutList: [],
};

const userSlice = createSlice({
  name: "user",
  initialState,
  reducers: {
		loginSuccess(state, action) {
			state.aboutList = action.payload.aboutList
			state.token = action.payload.token
			state.username = action.payload.username
		}
	},
});

export default userSlice
export const { loginSuccess } = userSlice.actions
